﻿
IF object_id(N'dbo.[UDS_Online]', 'U') IS NULL
BEGIN
    CREATE TABLE [dbo].[UDS_Online] (
        [Username]     nvarchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
        [LoginTime]    datetime     NULL,
        [ActiveTime]   datetime     NULL,
        [IpAddr]       nvarchar(50) COLLATE Chinese_PRC_CI_AS NULL,
        [AuthKey]      nvarchar(64) COLLATE Chinese_PRC_CI_AS NULL,
        [ActiveNodeID] int          NULL,

        CONSTRAINT [PK_UDS_Online] PRIMARY KEY CLUSTERED ([Username] asc),
        CONSTRAINT [FK_UDS_Online_Username] FOREIGN KEY (Username) REFERENCES [dbo].UDS_Staff (Staff_Name)
    );
END
GO
